//202102104015柴亚楠
package cn.edu.sdjzu.xg.kcsj.service;

import cn.edu.sdjzu.xg.kcsj.dao.ActorDao;
import cn.edu.sdjzu.xg.kcsj.domain.authority.Actor;
import util.JdbcHelper;

import java.sql.Connection;
import java.sql.SQLException;

public final class ActorService {
    private static final ActorDao actorDao = ActorDao.getInstance();
    private static final ActorService actorService = new ActorService();

    public static ActorService getInstance() {
        return actorService;
    }

    public Actor find(Integer id) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Actor actor = actorDao.find(connection,id);
        JdbcHelper.close(connection);
        return actor;
    }
    public Integer add() throws SQLException {
        Connection connection = JdbcHelper.getConn();
        int actorId = actorDao.add(connection);
        JdbcHelper.close(connection);
        return actorId;
    }
}
